#!/usr/bin/env python
# -*- coding:utf-8 -*-

# https://blog.csdn.net/sinat_41104353/article/details/79319343
# PanedWindow（窗格）组件(Tk8.4 新增是一个空间管理组件)。
# 跟 Frame 组件类似，都是为组件提供一个框架，不过 PanedWindow 允许让用户调整应用程序的空间划分。

from tkinter import *


def test_1():
    m = PanedWindow(orient=VERTICAL)
    m.pack(fill=BOTH, expand=1)

    top = Label(m, text='top pane')
    m.add(top)

    bottom = Label(m, text='bottom pane')
    m.add(bottom)
    # 拖拽鼠标的左键可以改变布局
    # 中间有条隐藏的线，是二窗格

    mainloop()


def test_2():
    # 创建一个三窗格
    m1 = PanedWindow()  # 默认是左右分布的
    m1.pack(fill=BOTH, expand=1)

    left = Label(m1, text='left pane')
    m1.add(left)

    m2 = PanedWindow(orient=VERTICAL)
    m1.add(m2)

    top = Label(m2, text='top pane')
    m2.add(top)

    bottom = Label(m2, text='bottom pane')
    m2.add(bottom)

    mainloop()


def test_3():
    # 显示手柄和分割线
    m1 = PanedWindow(showhandle=True, sashrelief=SUNKEN)  # 默认是左右分布的
    m1.pack(fill=BOTH, expand=1)

    left = Label(m1, text='left pane')
    m1.add(left)

    m2 = PanedWindow(orient=VERTICAL, showhandle=True, sashrelief=SUNKEN)
    m1.add(m2)

    top = Label(m2, text='top pane')
    m2.add(top)

    bottom = Label(m2, text='bottom pane')
    m2.add(bottom)

    mainloop()
    # 分割线上的类似正方形的东西就是handle


def main():
    from public_function import dict_choice
    choice = str(input("Enter a positive integer to choice: "))
    if choice in dict_choice.keys():
        exec(dict_choice[choice])
    else:
        print("输入有误，请重输！", choice)


if __name__ == "__main__":
    main()
